package at.mensch;

import java.util.ArrayList;
import java.util.List;

public class Table {
	private List<Field> fieldlist = new ArrayList<Field>();
	private List<HomeField> homeFields = new ArrayList<HomeField>(16);
	private List<FinishField> finishFields = new ArrayList<FinishField>(16);
	
	public Table(){
		for(int i=1;i<41;i++){
			Field f = new Field();
			f.setFieldId(i);
			f.setFieldTitle("Feld: "+(i));
			switch(i){
			case 1:
				f.setFieldImage("field1.png");
				
				break;
			case 11:
			case 21:
			case 31:
				f.setFieldImage("field"+((i/10)+1)+".png");
				break;
			default:
				f.setFieldImage("field.png");
				break;
			}
			
			this.fieldlist.add(f);
		}
		
		for(int i=41;i<57;i++){
			
			HomeField f = new HomeField();
			f.setFieldId(i);
			f.setFieldTitle("Feld "+i+": Startfeld Spieler");
			switch(i){
			case 41:
			case 42:
			case 43:
			case 44:
				f.setPlayerId(1);
				f.setFieldImage("field1.png");
				break;
			case 45:
			case 46:
			case 47:
			case 48:
				f.setPlayerId(2);
				f.setFieldImage("field2.png");
				break;
			case 49:
			case 50:
			case 51:
			case 52:
				f.setPlayerId(3);
				f.setFieldImage("field3.png");
				break;
			case 53:
			case 54:
			case 55:
			case 56:
				f.setPlayerId(4);
				f.setFieldImage("field4.png");
				break;
			}
			this.homeFields.add(f);
		}
		
		for(int i = 57; i<73;i++){
			FinishField f = new FinishField();
			f.setFieldId(i);
			f.setFieldTitle("Feld "+i+": Zielfeld Spieler");
			switch(i){
			case 57:
			case 58:
			case 59:
			case 60:
				f.setPlayerId(1);
				f.setFieldImage("field1.png");
				break;
			case 61:
			case 62:
			case 63:
			case 64:
				f.setPlayerId(2);
				f.setFieldImage("field2.png");
				break;
			case 65:
			case 66:
			case 67:
			case 68:
				f.setPlayerId(3);
				f.setFieldImage("field3.png");
				break;
			case 69:
			case 70:
			case 71:
			case 72:
				f.setPlayerId(4);
				f.setFieldImage("field4.png");
				break;
			}
			this.finishFields.add(f);
		}
	}

	public List<HomeField> getHomeFields() {
		return homeFields;
	}

	public void setHomeFields(List<HomeField> homeFields) {
		this.homeFields = homeFields;
	}

	public List<FinishField> getFinishFields() {
		return finishFields;
	}

	public void setFinishFields(List<FinishField> finishFields) {
		this.finishFields = finishFields;
	}

	public List<Field> getFieldlist() {
		return fieldlist;
	}

	public void setFieldlist(List<Field> fieldlist) {
		this.fieldlist = fieldlist;
	}
}
